public class 树测试 {
    public static void main(String[] args) {
        BiTreeNode root,node,leftNode,righttNode;
        root = new BiTreeNode('A',null,null);
        node =root;
        leftNode =new BiTreeNode('B',null,null);
        node.lchild=leftNode;
        righttNode=new BiTreeNode('C',null,null);
        node.rchild=righttNode;


        node=leftNode;
        leftNode=new BiTreeNode('D',null,null);
        node.lchild=leftNode;
        righttNode=new BiTreeNode('E',null,null);
        node.rchild=righttNode;

        node=leftNode;
        righttNode=new BiTreeNode('F',null,null);
        node.rchild=righttNode;
        node.rchild.lchild=new BiTreeNode('H',null,null);

        node=root.lchild.rchild;
        node.lchild=new BiTreeNode('G',null,null);

        System.out.println("递归先序遍历二叉树");
//        preOerder(root);
        inOrder(root);
//        postOrder(root);
    }

    public static void preOerder(BiTreeNode root) {
        if (root==null)
            return;
        System.out.println(root.data+"  ");
        preOerder(root.lchild);
        preOerder(root.rchild);
    }
    public static void inOrder(BiTreeNode root){
        if (root==null)
            return;
        inOrder(root.lchild);
        System.out.println(root.data+" ");
        inOrder(root.rchild);
    }
    public static void postOrder(BiTreeNode root){
        if (root==null)
            return;
        postOrder(root.lchild);
        postOrder(root.rchild);
        System.out.println(root.data+" ");
    }
}
